package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.ProcessOfflineList;
import com.indusfo.spc.service.ProcessOfflineListService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ProjectName: jpa05
 * @Package: com.indusfo.spc.controller
 * @ClassName: ProcessOfflineListController
 * @Author: 熊冰
 * @Description: 流程维修下线子工序关联采集项目
 * @Date: 2019/10/28 14:55
 * @Version: 1.0
 */


@Controller
@RequestMapping("/processOfflineList")
public class ProcessOfflineListController {
	@Autowired
	private ProcessOfflineListService processOfflineListService;

	/**
	 * 修改
	 *
	 * @param processOfflineList
	 * @return
	 */
	@RequestMapping(value = "/updateProcessOfflineList",method= RequestMethod.POST)
	@SystemControllerLog(description="修改")
	@ResponseBody
	public JSONObject updateProcessOfflineList (ProcessOfflineList processOfflineList){

		JSONObject json=processOfflineListService.updateProcessOfflineList(processOfflineList);

		return json;
	}

	/**
	 * 查询
	 *
	 * @param
	 * @return com.indusfo.spc.vo.JSONObject
	 */
	@RequestMapping(value="/queryProcessOfflineList")
	@SystemControllerLog(description="查询")
	@ResponseBody
	public JSONObject queryDep(ProcessOfflineList processOfflineList) {

		JSONObject json = processOfflineListService.queryProcessOfflineList(processOfflineList);
		return json;

	}

	/**
	 * 插入
	 *
	 * @return com.indusfo.spc.vo.JSONObject
	 */
	@RequestMapping(value="/insertProcessOfflineList", method= RequestMethod.POST)
	@SystemControllerLog(description="新增")
	@ResponseBody
	public JSONObject insertProcessOfflineList(ProcessOfflineList processOfflineList) {

		JSONObject json = processOfflineListService.insertProcessOfflineList(processOfflineList);
		return json;
	}

	/**
	 * 启用/停用
	 *
	 * @param processOfflineListIds, dataState
	 * @return com.indusfo.spc.vo.JSONObject
	 */
	@RequestMapping(value="/definesProcessOfflineList", method= RequestMethod.POST)
	@SystemControllerLog(description="启用/停用")
	@ResponseBody
	public JSONObject definesProcessOfflineList(@RequestParam("processOfflineListIds")List<Integer>  processOfflineListIds, Integer dataState) {

		JSONObject json = processOfflineListService.deleteProcessOfflineList(processOfflineListIds, dataState);
		return json;
	}

	/**
	 * 删除
	 *
	 * @param processOfflineListIds, dataState
	 * @return com.indusfo.spc.vo.JSONObject
	 */
	@RequestMapping(value="/deleteProcessOfflineList", method= RequestMethod.POST)
	@SystemControllerLog(description="删除")
	@ResponseBody
	public JSONObject delProcessOfflineList(@RequestParam("processOfflineListIds") List<Integer> processOfflineListIds, Integer dataState) {

		dataState = 2;
		JSONObject json = processOfflineListService.deleteProcessOfflineList(processOfflineListIds, dataState);
		return json;
	}
}
